MorphologicalComponents
MorphologicalComponents[image] gives an array in which each pixel of image is replaced by an integer index representing the connected foreground image component in which the pixel lies.
MorphologicalComponents[image,t] treats values above t as foreground.
MorphologicalComponents[video,…] computes connected components in frames of video.
Please visit the official Wolfram Language Reference for more details and examples on core symbols.